<!-- 证件号码控件 -->

<template>
  <a-space direction="vertical" style="width: 100%">
    <a-input-number
      v-model="modelValue"
      :placeholder="getProps.placeholder"
      :disabled="disabled"
      hide-button
    />
  </a-space>
</template>

<script lang="ts" setup>
const props = withDefaults(
  defineProps<{
    props: { [propName: string]: any };
    name?: string;
    required?: boolean;
    oneValue: any;
    disabled?: boolean;
    regex?: {
      [name: string]: {
        role: any;
        name: any;
      };
    };
  }>(),
  {}
);
const emit = defineEmits(['update:oneValue']);
const modelValue = computed({
  get: () => {
    try {
      if (isNaN(Number(props.oneValue))) {
        throw new Error('传进来的参数有问题');
      }
      return Number(props.oneValue);
    } catch (error) {
      console.log('error,error');
    }
  },
  set: (val) => {
    emit('update:oneValue', val);
  }
});
//复制一份props
const getProps = computed(() => {
  return props.props;
});
</script>

<style scoped lang="less"></style>
